package ${packageName}.controller;

import ${packageName}.entity.*;
import ${packageName}.repository.*;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.PageRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.ResponseEntity;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;



import java.util.*;

/**
* ${classInfo.classComment}
* @author ${authorName} ${.now?string('yyyy-MM-dd')}
*/
@RestController
@RequestMapping("/${classInfo.tableName}")
public class ${classInfo.className}Controller {

    @Autowired
    private ${classInfo.className}ReactiveRepository ${classInfo.className?uncap_first}ReactiveRepository;

 /**
    * 新增或编辑
    */
    @PostMapping("/save")
    public Mono<${classInfo.className}> save(@RequestBody ${classInfo.className} ${classInfo.className?uncap_first}){
        return  ${classInfo.className?uncap_first}ReactiveRepository.save(${classInfo.className?uncap_first});
    }

    /**
    * 删除
    */
    @GetMapping("/deleteById/{id}")
    public Mono<Void> deleteById(@PathVariable String id){
        return ${classInfo.className?uncap_first}ReactiveRepository.deleteById(id);
    }

    /**
    * 查询
    */
    @GetMapping("/findById/{id}")
    public Mono<${classInfo.className}> findById(@PathVariable String id){
        return ${classInfo.className?uncap_first}ReactiveRepository.findById(id);
    }

}
